import delimited "qualtricsdataapril4.csv"
rename q43 control
rename q34 group
rename q35 white
rename q36 white_group
rename q37 arab
rename q38 arab_group

replace control = 0 if control == .
replace group = 0 if group == .
replace white = 0 if white == .
replace white_group = 0 if white_group==.
replace arab = 0 if arab == .
replace arab_group = 0 if arab_group == .

rename q3 label
gen label2 = label
replace label2 = 6 if label2 ==1
replace label2 = 6 if label2 ==4

gen terror = 0
replace terror = 1 if label ==3
gen shooting = 0
replace shooting = 1 if label ==2

gen insanity = 0
replace insanity = 1 if q45_5 == 1
gen religious = 0
replace religious = 1 if q45_3==1

gen all_group = 0
replace all_group = 1 if group == 1
replace all_group = 1 if white_group ==1
replace all_group = 1 if arab_group==1


gen treatment = 0
replace treatment = 1 if group == 1
replace treatment = 2 if white == 1
replace treatment = 3 if white_group ==1
replace treatment = 4 if arab==1
replace treatment = 5 if arab_group==1

rename v60 resp_gender
rename q33 age
gen male = 0
replace male = 1 if resp_gender == 1
rename v61 educ
rename v62 resp_race
gen white_resp = 0
replace white_resp = 1 if resp_race==1
rename v64 income
rename v66 resp_ideology


rename q45_1 motive_criminal
rename q45_2 motive_racial
rename q45_3 motive_religious
rename q45_4 motive_political
rename q45_5 motive_insanity
rename q45_7 motive_other
replace motive_criminal = 0 if motive_criminal ==.
replace motive_racial = 0 if motive_racial ==.
replace motive_religious = 0 if motive_religious ==.
replace motive_political = 0 if motive_political ==.
replace motive_insanity = 0 if motive_insanity ==.
replace motive_other = 0 if motive_other ==.


*APPENDIX TABLES*

*With Controls
logit terror i.group i.white i.arab i.white_group i.arab_group age educ income male resp_ideology white_resp
logit shooting i.group i.white i.arab i.white_group i.arab_group age educ income male resp_ideology white_resp


*Sub-sample RACE*
logit terror i.group i.white i.arab i.white_group i.arab_group if resp_race==1
margins r.arab, contrast

logit shooting i.group i.white i.arab i.white_group i.arab_group if resp_race==1

logit terror i.group i.white i.arab i.white_group i.arab_group if resp_race!=1
margins r.arab, contrast
logit shooting i.group i.white i.arab i.white_group i.arab_group if resp_race!=1


*Sub-sample GENDER*
logit terror i.group i.white i.arab i.white_group i.arab_group if resp_gender==1
logit terror i.group i.white i.arab i.white_group i.arab_group if resp_gender==2

logit shooting i.group i.white i.arab i.white_group i.arab_group if resp_gender==1
logit shooting i.group i.white i.arab i.white_group i.arab_group if resp_gender==2

*Sub-sample IDEOLOGY*
logit terror i.group i.white i.arab i.white_group i.arab_group if resp_ideology<=3
logit terror i.group i.white i.arab i.white_group i.arab_group if resp_ideology>3

logit shooting i.group i.white i.arab i.white_group i.arab_group if resp_ideology<=3
logit shooting i.group i.white i.arab i.white_group i.arab_group if resp_ideology>3

*With controls*
logit terror group white arab white_group arab_group age male educ income white_resp resp_ideology
logit shooting group white arab white_group arab_group age male educ income white_resp resp_ideology

